var $ = require('jquery');
/*
var resp = {
	"status": 200,
	"message": "登录成功！",
	"error": "",
	"data": {
		"name": "丁琼",
		"sessionid": "ff010d6cbe554ad09f40e34607cebe3d"
	}
};


var mockques = [{
	"id": 2595,
	"course": 1,
	"type": 1,
	"mark": 1,
	"grade": 3,
	"answer": "A",
	"question": "采用保险人提供的格式条款订立的保险合同中的条款中无效的有()。",
	"sa": "加重投保人、被保险人责任的",
	"sb": "规定等待期的",
	"sc": "强调投保人、被保险人或者受益人依法享有的权利的",
	"sd": "规定免除责任的",
	"se": "",
	"sf": ""
}, {
	"id": 1964,
	"course": 1,
	"type": 3,
	"mark": 1,
	"grade": 1,
	"answer": "B",
	"question": "预约挂号健康增值服务不可以跨区域(城市)使用，使用前预约好相应地区的医疗机构即可。",
	"sa": "对",
	"sb": "错",
	"sc": "",
	"sd": "",
	"se": "",
	"sf": ""
}, {
	"id": 204,
	"course": 1,
	"type": 1,
	"mark": 1,
	"grade": 1,
	"answer": "C",
	"question": "特约商户在我行申请安装POS机具，必须()。",
	"sa": "在他行开立资金结算账户",
	"sb": "在我行开立存折",
	"sc": "在我行开立资金结算账户",
	"sd": "在我行开华夏卡",
	"se": "",
	"sf": ""
}, {
	"id": 2470,
	"course": 1,
	"type": 1,
	"mark": 1,
	"grade": 1,
	"answer": "B",
	"question": "延期合约结算价是指某延期合约整个交易日的成交价格按照()的加权平均价。",
	"sa": "成交金额",
	"sb": "成交量",
	"sc": "交收数量",
	"sd": "交收金额",
	"se": "",
	"sf": ""
}, {
	"id": 2637,
	"course": 1,
	"type": 1,
	"mark": 1,
	"grade": 3,
	"answer": "A",
	"question": "设立保险公司，其注册资本的最低限额为人民币()元。",
	"sa": "二亿",
	"sb": "三亿",
	"sc": "四亿",
	"sd": "五亿",
	"se": "",
	"sf": ""
}, {
	"id": 2091,
	"course": 1,
	"type": 4,
	"mark": 1,
	"grade": 3,
	"answer": "存款、理财、基金、三方存管、黄金、国债、保险",
	"question": "金融资产状况是指包含()7项金融资产的总和",
	"sa": "",
	"sb": "",
	"sc": "",
	"sd": "",
	"se": "",
	"sf": ""
}, {
	"id": 2096,
	"course": 1,
	"type": 1,
	"mark": 1,
	"grade": 3,
	"answer": "C",
	"question": "地下钱庄主要洗钱方式和手法不包括()。",
	"sa": "以空壳公司为掩护开立多个洗钱账户",
	"sb": "在多家银行开立多个个人账户用于取现",
	"sc": "投资理财",
	"sd": "通过网上银转移资金",
	"se": "",
	"sf": ""
}, {
	"id": 2547,
	"course": 1,
	"type": 3,
	"mark": 1,
	"grade": 3,
	"answer": "A",
	"question": "分行应根据协议条款按时、足额的向保险公司收取代理保险手续费，纳入手续费账户核算，不得随意提支代理保险手续费或以现金方式收取代理手续费。保险公司向我行支付代理保险手续费，应当通过其一级分支机构向我行一级分支机构或至少二级分支机构统一转账支付。",
	"sa": "对",
	"sb": "错",
	"sc": "",
	"sd": "",
	"se": "",
	"sf": ""
}]*/

module.exports = {
	getPraQues: function(sessionid, amount, course, callback) {
		$.getJSON('/api/practice/questions/', {
			sessionid: sessionid,
			amount: amount,
			course: course
		}, callback);
		//callback(mockques);
	},
	submitPra: function(sessionid, course,score, doneids, errorids, callback) {
		$.post('/api/practice/', {
			sessionid: sessionid,
			score: score,
			course:course,
			doneids: doneids,
			errorids: errorids,
		}, callback);
		//callback(resp);
	},
	//拿到测试的问题
	getTestQues: function(sessionid, amount, course, callback) {
		$.getJSON('/api/test/questions/', {
			sessionid: sessionid,
			amount: amount,
			course: course
		}, callback);
		//callback(mockques);
	},
	//提交测试的结果
	submitTest: function(sessionid,course, score, doneids, errorids, callback) {
		$.post('/api/test/', {
			sessionid: sessionid,
			score: score,
			course:course,
			doneids: doneids,
			errorids: errorids,
		}, callback);
	//	callback(resp);
	},
	//拿到错题练习的问题
	getErrQues: function(sessionid, amount, course, callback) {
		$.getJSON('/api/practice/errors/', {
			sessionid: sessionid,
			amount: amount,
			course: course
		}, callback);
		//callback(mockques);
	},
	submitErr: function(sessionid,course, rightids, callback) {
		$.post('/api/practice/errors', {
			sessionid: sessionid,
			course:course,
			rightids: rightids,
		}, callback);
		//callback(resp);
	},

};